/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author TRieu Luu
 */
@Entity
@Table(name = "EMPLOYEEPROJECT")
@NamedQueries({
    @NamedQuery(name = "Employeeproject.findAll", query = "SELECT e FROM Employeeproject e")})
public class Employeeproject implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected EmployeeprojectPK employeeprojectPK;
    @Column(name = "JoinedDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date joinedDate;
    @Column(name = "Status")
    private Integer status;
    @JoinColumn(name = "ProjectID", referencedColumnName = "ProjectID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Project project;
    @JoinColumn(name = "EmployeeID", referencedColumnName = "EmployeeID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Employee employee;

    public Employeeproject() {
    }

    public Employeeproject(EmployeeprojectPK employeeprojectPK) {
        this.employeeprojectPK = employeeprojectPK;
    }

    public Employeeproject(String projectID, int employeeID) {
        this.employeeprojectPK = new EmployeeprojectPK(projectID, employeeID);
    }

    public EmployeeprojectPK getEmployeeprojectPK() {
        return employeeprojectPK;
    }

    public void setEmployeeprojectPK(EmployeeprojectPK employeeprojectPK) {
        this.employeeprojectPK = employeeprojectPK;
    }

    public Date getJoinedDate() {
        return joinedDate;
    }

    public void setJoinedDate(Date joinedDate) {
        this.joinedDate = joinedDate;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (employeeprojectPK != null ? employeeprojectPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employeeproject)) {
            return false;
        }
        Employeeproject other = (Employeeproject) object;
        if ((this.employeeprojectPK == null && other.employeeprojectPK != null) || (this.employeeprojectPK != null && !this.employeeprojectPK.equals(other.employeeprojectPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Employeeproject[ employeeprojectPK=" + employeeprojectPK + " ]";
    }
    
}
